use QLK;
go
create proc sp_getAllAcount
as
	select * from login
go
Create proc sp_getpass
	@pass varchar(15)
as
	select * from login where [Password] like @pass
go
Create proc sp_getuser
	@user varchar(15)
as
	select * from login where Usename like @user
go
create proc sp_getstatus
	@status varchar(10)
as
	select Status from login where Status like @status
go
create proc sp_Insertlogin
	@user varchar(15),
	@pass varchar(15),
	@status varchar(10)
as
	insert into login values(@user, @pass, @status)
go
create proc sp_Updatelogin
	@user varchar(15),
	@pass varchar(15),
	@status varchar(10)
as
	update login
	set
		Usename = @user,
		Password = @pass,
		Status = @status
go
create proc sp_dellogin
	@user varchar(15)
as
	Delete from login where Usename like @user
go
create proc changePass
	@user varchar(15),
	@pass varchar(15)
as
	update login
set
	Password = @pass,
	Usename = @user
where
	Usename = @user	
----------------------------------------------------------
go
create proc sp_getAllNCC
as
	select * from NCC
go
create proc sp_getMaNCC
	@MaNCC varchar(10)
as
	select * from NCC where MaNCC like @MaNCC
go
create proc sp_getTenNCC
	@TenNCC varchar(25)
as
	select * from NCC where TenNCC like @TenNCC
go
create proc sp_InsertNCC
	@MaNCC varchar(10).
	@TenNCC varchar(25),
	@diachi varchar(50),
	@Mst varchar(10),
	@Sotk varchar(10)
as
	insert into NCC values(@MaNCC, @TenNCC, @diachi, @Mst, @Sotk)
go
create proc sp_UpdateNCC
	@MaNCC varchar(10).
	@TenNCC varchar(25),
	@diachi varchar(50),
	@Mst varchar(10),
	@Sotk varchar(10)
as
	update NCC
set
	MaNCC = @MaNCC, TenNCC = @TenNCC, DiaChi = @diachi, Masothue = @Mst, SoTK = @Sotk
go
create proc sp_DelNCC
	@MaNCC varchar(10).
as
	delete from NCC where MaNCC like @MaNCC